<script setup>
import { useI18n } from 'vue-i18n'
import { ref, onMounted } from 'vue'

const { t } = useI18n()
const isVisible = ref(false)
const sectionRef = ref(null)

onMounted(() => {
  const observer = new IntersectionObserver((entries) => {
    entries.forEach(entry => {
      if (entry.isIntersecting) {
        isVisible.value = true
        observer.disconnect()
      }
    })
  }, { threshold: 0.2 })
  
  if (sectionRef.value) {
    observer.observe(sectionRef.value)
  }
})
</script>

<template>
  <section ref="sectionRef" class="entry-section">
    <div class="entry-container">
      <h2 class="entry-title" :class="{ 'animate': isVisible }">
        <span class="english-title">3 steps for the perfect trip</span>
        <span class="chinese-title">三步解锁免签，轻松踏上中国之旅</span>
      </h2>
      <p class="entry-subtitle" :class="{ 'animate': isVisible }">An enim nullam tempor gravida donec enim congue magna at pretium purus pretium ligula rutrum luctus risusd diam eget risus varius blandit sit amet non magna.</p>
      
      <div class="entry-grid">
        <div 
          class="entry-card" 
          :class="{ 'animate': isVisible }"
          :style="{ animationDelay: '0.1s' }"
        >
          <div class="card-content">
            <div class="icon-wrapper">
              <img src="@/assets/icons/luggage.svg" alt="确认免签资格" class="step-icon" />
            </div>
            <h3>确认免签资格</h3>
            <p class="entry-description">您需先确认自己所属国家是否在当前中国免签政策覆盖范国之中。与此同时，要明确自身旅行目的是否符合免签规定中的商务、旅游观光、探亲访友以及过境等范畴。</p>
          </div>
        </div>
        <div 
          class="entry-card" 
          :class="{ 'animate': isVisible }"
          :style="{ animationDelay: '0.3s' }"
        >
          <div class="card-content">
            <div class="icon-wrapper">
              <img src="@/assets/icons/taxi.svg" alt="规划行程与准备材料" class="step-icon" />
            </div>
            <h3>规划行程与准备材料</h3>
            <p class="entry-description">在确定符合免签资格之后，进行详细行程规划。涵盖确定抵达口岸、旅行路线以及停留时间等方面。护照的有效期需要在预计离境中国的日期之后仍然至少有 6 个月及以上。</p>
          </div>
        </div>
        <div 
          class="entry-card" 
          :class="{ 'animate': isVisible }"
          :style="{ animationDelay: '0.5s' }"
        >
          <div class="card-content">
            <div class="icon-wrapper">
              <img src="@/assets/icons/stars.svg" alt="入境通关" class="step-icon" />
            </div>
            <h3>入境通关</h3>
            <p class="entry-description">携带好好的护照及相关材料，按规划行程抵达中国免签政策适用口岸。边检审核通过后，即可顺利入境中国，开启免签之旅。</p>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<style scoped>
/* 入境通关区域样式 */
.entry-section {
  padding: 80px 152px;
  background: rgba(242, 251, 250, 1);
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 876px;
}

.entry-container {
  max-width: 1600px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.entry-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.entry-title.animate {
  opacity: 1;
  transform: translateY(0);
}

.english-title {
  color: #00c389;
  font-size: 1.5rem;
  font-weight: 600;
}

.chinese-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2a2d32;
}

.entry-subtitle {
  font-size: 1.1rem;
  color: #6b7280;
  margin-bottom: 60px;
  max-width: 800px;
  line-height: 1.6;
  margin: 0 auto 60px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s ease 0.2s;
}

.entry-subtitle.animate {
  opacity: 1;
  transform: translateY(0);
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 416px);
  gap: 24px;
  position: relative;
  justify-content: center;
}

.entry-card {
  background: #fff;
  border-radius: 16px;
  height: 416px;
  padding: 48px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.entry-card.animate {
  opacity: 1;
  transform: translateY(0);
}

.entry-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 195, 137, 0.15);
}

.icon-wrapper {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  transition: transform 0.5s ease;
}

.entry-card:hover .icon-wrapper {
  transform: scale(1.1) rotate(5deg);
}

.icon-wrapper::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: currentColor;
  clip-path: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  opacity: 0.1;
  border-radius: 24px;
  transform: scale(0.95);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.entry-card:hover .icon-wrapper::before {
  transform: scale(1);
  opacity: 0.2;
}

.entry-card:nth-child(1) .icon-wrapper {
  color: rgb(255, 107, 107);
}

.entry-card:nth-child(2) .icon-wrapper {
  color: rgb(82, 113, 255);
}

.entry-card:nth-child(3) .icon-wrapper {
  color: rgb(0, 195, 137);
}

.step-icon {
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.5s ease;
}

.entry-card:hover .step-icon {
  transform: rotate(-10deg);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.card-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.card-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2a2d32;
  text-align: center;
  position: relative;
  transition: color 0.3s ease;
}

.entry-card:hover .card-content h3 {
  color: #00c389;
}

.card-content h3::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -8px;
  left: 50%;
  background-color: #00c389;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.entry-card:hover .card-content h3::after {
  width: 40px;
}

.entry-description {
  color: #52565e;
  font-size: 1rem;
  line-height: 1.8;
  flex-grow: 1;
  text-align: left;
  transition: color 0.3s ease;
}

.entry-card:hover .entry-description {
  color: #333;
}

/* 响应式样式 */
@media (max-width: 1400px) {
  .entry-section {
    height: auto;
    min-height: 876px;
  }

  .entry-container {
    max-width: 100%;
    padding: 0 40px;
  }

  .entry-grid {
    grid-template-columns: repeat(3, 350px);
  }

  .entry-card {
    height: 350px;
    padding: 32px;
  }

  .icon-wrapper {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
  }

  .icon-wrapper::before {
    border-radius: 20px;
  }

  .step-icon {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 1200px) {
  .entry-section {
    padding: 60px 40px;
    height: auto;
    min-height: 876px;
  }
  
  .entry-grid {
    grid-template-columns: repeat(3, 300px);
    gap: 20px;
  }

  .entry-card {
    height: 300px;
    padding: 24px;
  }
  
  .chinese-title {
    font-size: 2.2rem;
  }

  .card-content {
    gap: 16px;
  }

  .card-content h3 {
    font-size: 1.3rem;
  }
}

@media (max-width: 992px) {
  .entry-section {
    height: auto;
    min-height: 876px;
  }

  .entry-grid {
    grid-template-columns: minmax(280px, 416px);
    max-width: 416px;
    margin: 0 auto;
  }
  
  .entry-card {
    height: auto;
    min-height: 300px;
  }
  
  .entry-card.animate {
    animation-delay: 0s !important;
  }
}

@media (max-width: 768px) {
  .entry-section {
    padding: 50px 30px;
    height: auto;
    min-height: 876px;
  }
  
  .english-title {
    font-size: 1.3rem;
  }
  
  .chinese-title {
    font-size: 2rem;
  }
  
  .entry-subtitle {
    font-size: 1rem;
    margin-bottom: 40px;
  }
  
  .entry-description {
    font-size: 0.95rem;
  }
}

@media (max-width: 576px) {
  .entry-section {
    padding: 40px 20px;
    height: auto;
    min-height: 876px;
  }
  
  .entry-grid {
    grid-template-columns: 1fr;
  }

  .entry-card {
    padding: 24px;
    min-height: 280px;
  }
  
  .chinese-title {
    font-size: 1.8rem;
  }
  
  .entry-subtitle {
    font-size: 0.9rem;
  }

  .icon-wrapper {
    width: 56px;
    height: 56px;
    margin-bottom: 20px;
  }

  .icon-wrapper::before {
    border-radius: 16px;
  }

  .step-icon {
    width: 28px;
    height: 28px;
  }
}
</style> 